package org.codeart.api_driver.controller;

import org.codeart.api_driver.service.PayService;
import org.codeart.common.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pay")
public class PayController {

    @Autowired
    private PayService payService;

    /**
     * 司机发起收款
     */
    @PostMapping("/push-pay-info")
    public R<Void> pushPayInfo(@RequestParam("orderId") Long orderId, @RequestParam("price") Double price,
                            @RequestParam("passengerId") Long passengerId) {
        boolean b = payService.pushPayInfo(orderId, price, passengerId);
        if (b) {
            return R.ok();
        }
        return R.fail("推送账单失败");
    }


}
